package plg.grupo1.Lexico.StateMachineHierarchy;

public class State2 implements State{
	
    private static State2 INSTANCE = null;
	private State2(){}
	
    private synchronized static void createInstance() {
        if (INSTANCE == null) INSTANCE = new State2();
    }
    
    public static State2 getInstance() {
        if (INSTANCE == null) createInstance();
        return INSTANCE;
    }
    
	public void goNext(){

		if(Contexto.isEof()) 
			Contexto.setCurrentState(State1.getInstance());
		else{
			char c = Contexto.getCharAndMoveToNext();//A	
			if(c==';')
			{
				Contexto.setCurrentState(State1.getInstance());
				Contexto.appendToLexema(c);//B
			}
			else
				Contexto.setCurrentState(State21.getInstance());
		}	
	}
}
